<!DOCTYPE html>
<html>
<head>
<title>csis Technical Documentation</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>

<body>
<p>This document contains a top-down analysis of the csis program.</p>

<h1 id="Index">Index</h1>
<ol>
	<li><a href="#Ch1">Console Interface</a>
		<ol>
			<li><a href="#Ch1-1">Command Line Interpreter</a></li>
		</ol>
	</li>
	<li><a href="#Ch2">Shell</a></li>
	<li><a href="#Ch3">Immediator</a></li>
</ol>

<!-- Console Interface -->
<h1 id="Ch1">1 Console Interface</h1>

<p><code>Program.cs</code> takes command-line arguments. Arguments are parsed and converted to a 
<code>ShellOptions</code> object by <code>CommandLineInterpreter</code>.</p>

<p>Using the <code>ShellOptions</code> object, a <code>Shell</code> object can be started and 
executes the application.</p>

<p><a href="#Index">Index</a></p>

<!-- Command Line Interpreter -->

<h2 id="Ch1-1">1.1 Command Line Interpreter</h2>

<p><code>CommandLineInterpreter</code> constructor takes an <code>IEnumerable&lt;string></code>. 
Upon calling the constructor, the input is interpreted, and the result is stored in the
<code>ShellOptions</code> property.</p>

<p>The arguments are parsed in a way that avoids ambiguity. Normally, only <em>switches</em> are 
allowed. Switches start with a <code>/</code> or a <code>-</code>. Since in this state, the parser
only expects switches, but not files, it is never ambiguous in any file system whether the argument
passed is a file, or a switch.</p>

<p>Some switches consume additional arguments after the switch has been found. After the <code>/f</code>
switch, the parser expects a file name next. Even if it starts with a <code>/</code> or <code>-</code>, i
t is never ambiguous whether the argument is a file, because in this state, the parser always expects
a file.</p>

<p>All options are directly written to the <code>ShellOptions</code> object that is being built.
Any parse errors are added to a list within that object.</p>

<p><a href="#Index">Index</a></p>

<!-- Shell -->

<h1 id="Ch2">2 Shell</h1>

<p>The <code>Shell</code> class takes a finished <code>ShellOptions</code> object and then starts the 
desired operations and interacts with the end-user accordingly via console output. The shell reports
success or failure via a <code>bool</code>.</p>

<p>A user can specify their intentions by building a <code>ShellOptions</code> object programmatically
and directly passing it to a <code>Shell</code> to get around having to use the syntax necessary for
the <code>CommandLineInterpreter</code>.

<p><a href="#Index">Index</a></p>

<h1 id="Ch3">3 Immediator</h1>

<p>The immediator performs the core operations. It takes an <code>ImmediatorOptions</code> object
that can be build by hand, or using the <code>CommandLineInterpreter</code>.</p>

<p>The immediator operation consists of 2 steps: <em>Compilation</em> and <em>Execution</em>. 
Compilation is always performed, but execution may be suppressed using the <code>NoExecution</code>
property.</p>

</body>
</html>















